1. Field of the Invention
The present invention relates to a nonvolatile semiconductor memory device.
2. Description of the Related Art
At present, a magnetic disk device is popularly used as a secondary memory device for a computer. In recent years, an electrically erasable programmable non-volatile semiconductor memory (to be referred to as an "EEPROM" hereinafter) has been used in place of a magnetic disk device because the EEPROM has characteristic features such as high reliability to mechanical strength, low power consumption, portability, and a high-speed access operation. However, the magnetic disk device is different from the EEPROM in function. For this reason, control for eliminating the difference must be performed to replace the conventional magnetic disk device with the EEPROM.
As one type of EEPROM, a NAND-type EEPROM which can be integrated at a high integration density is known. The NAND-type EEPROM is constituted as follows. That is, as shown in FIG. 1, one unit is formed by series-connecting a plurality of memory cells M.sub.1 to M.sub.8 in which the source and drain of adjacent memory cells are commonly used, and one terminal of the unit is connected to a bit line (not shown). One memory cell generally has an FETMOS structure obtained by stacking a charge accumulation layer and a control gate. The memory cell array is integrated in a p-type well formed in a p-type substrate or an n-type substrate. The drain side of each of the memory cells is connected to the bit line through a selection gate S.sub.1, and the source side of each of the memory cells is connected to a source line (reference potential line) through a selection gate S.sub.2. Control gates CG.sub.1 to CG.sub.8 of the memory cells M.sub.1 to M.sub.8 are continuously connected to each other in a row direction to form a word line. A set of the memory cells connected to the same word line is referred to as a page, and a set of pages interposed between a set of drain- and source-side selection gates is referred to as a NAND-type block or, simply, a block. A circuit arrangement of a block is shown in FIG. 2. One block is normally used as one unit which can be independently erased.
The operation of the NAND-type EEPROM is as follows. Data of all the memory cells in a NAND-type block are simultaneously erased. The voltages of all the control gates CG.sub.1 to CG.sub.8 of the selected NAND-type block are set to be a reference potential V.sub.SS, and a high voltage V.sub.PP (e.g., 20 V) is applied to a p-type well and an n-type substrate. In this manner, electrons are discharged from the floating gates of all the memory cells to the substrate, and the threshold value of each memory cell is shifted in a negative direction. This state is normally defined as a "1" state. Chip erasure is performed by setting all the NAND-type blocks in a selection state.
An operation of writing data is sequentially performed from the memory cell M.sub.8 located at a position farthest from the bit line. A high voltage V.sub.PP (e.g., 20 V) is applied to a selected control gate in a NAND-type block, and an intermediate potential V.sub.M (e.g., 10 V) is applied to a non-selected gate. The voltage of V.sub.SS or V.sub.M is applied to the bit line BL in accordance with data. When the voltage V.sub.SS is applied to the bit line BL, ("0" is written), the potential V.sub.SS is transmitted to the selected memory, electrons are injected in the floating gate of the selected memory, and the threshold value of the selected memory is shifted in a positive direction. This state is normally defined as a "0" state. When the voltage V.sub.M is applied to the bit line ("1" is written), electron injection does not occur in the memory cell, and the threshold value is maintained at a constant negative valve. An operation of reading data is performed as follows. That is, the control gate voltage of a selected memory cell in a NAND-type block is set to be V.sub.SS, and the control and selection gates of the memory cells other than the selected memory cell are set to be V.sub.CC, thereby detecting whether a current flows in the selected memory cell.
In the NAND-type EEPROM, a data writing operation must be sequentially performed from a page near the source line to a page on the drain side. This necessity will be described below with reference to FIGS. 3A and 3B.
When "1" is written, the intermediate potential V.sub.M (about 10 V) is transferred to the drain of the selected memory cell, and an erasure state (i.e., a negative threshold value) is maintained without performing any electron injection. FIGS. 3A and 3B show a state wherein a control gate 1 is set in a selection state (V.sub.PP). The control gate 2 is not selected, and the voltage V.sub.M is applied to the control gate 2. The voltage V.sub.M ("1" is written) is also applied the drains. FIG. 3A shows the case wherein write access is performed from the source side, and FIG. 3B shows the case wherein write access is performed from the drain side.
In the case of FIG. 3A, the voltage V.sub.M is reliably transferred to a source-side cell Ma1 because the threshold value of a drain-side cell Ma2 is negative. In the case of FIG. 3B, if "0" is written in a drain-side cell Mb2 in advance, and the drain-side cell Mb2 has a positive threshold value (e.g., 3.5 V), only a voltage obtained by subtracting the threshold value of the cell Mb2 from the voltage V.sub.M is transferred to the cell Mb1 when "1" is to be written in the source-side cell Mb1. For this reason, a potential difference between the control gate and the substrate is increased in the cell Mb1, and write access may be erroneously performed. As described above, means for sequentially performing write access from the source side is important to prevent erroneous write access.
In a conventional magnetic disk device, accesses such as read or write access of data is performed using a sector as a unit. Each storage area formed concentrically formed on a magnetic recording medium is called a track. The track is divided into several areas to form storage units called sectors. The capacity of one sector of a typical magnetic disk device used in a portable computer for personal use is 512 bytes.
When the computer causes the magnetic disk device to store data, a mass of data is called a file. A function of managing positions at which the file is stored is a critical function of an operation system (to be referred to as an "OS" hereinafter).
FIG. 4 is a view showing the manner in which the MS-DOS as a typical OS used in a portable computer for personal use uses the storage areas of a magnetic disk device to manage files. A boot area 61 is an area in which data required for starting the operation of the computer is stored, and the boot area 61 is not related to management of user files. File names and a management table for recording data related to the file names are stored in a root directory area 64. Although sub-directories are managed in the same manner as that of the root directory, the sub-directories each having the same content as that of the root directory can be hierarchically present in a data area. These subdirectories are simply called directories because each of the sub-directories has the same function as that of the directory, although the sub-directories are different from the directories in areas and levels in hierarchy. Data related to one file in a directory occupies a 32-byte area, and the content of the data is shown in FIG. 5.
Data recording of the magnetic disk device is performed using a sector as a unit as described above. When an area on the disk is to be allocated to a file, a logical unit called a cluster is used. One cluster is determined depending on the types of disks such that one cluster is constituted by sectors, the number of which is a power of 2. A start cluster number 66 in FIG. 5 is the number of a cluster allocated to the start address of a file. File allocation data for the data area is stored in a FAT area 62 in FIG. 4. The file allocation data represents the manner in which the clusters are connected to constitute one file in a data area 65. Backup data 63 obtained by copying the FAT area 62 is written in the management table. As described above, the MS-DOS file management is performed on the basis of data in the FAT area and the root directory area. The positions and sizes of these areas are fixedly determined depending on the types of disks.
An access unit of a NAND-type EEPROM is one page as described above. When a 4-Mbit NAND-type EEPROM is used as an example, 1 page is constituted by 512 bytes, and 1 block is constituted by 8 pages. In an application in which a magnetic disk device is replaced with a NAND-type EEPROM, when one sector of the disk corresponds to one page of the NAND-type EEPROM, the disk device can easily be converted into the NAND-type EEPROM. As a significant difference between the magnetic disk device and the EEPROM posed when the magnetic disk device is to be replaced with the EEPROM, a difference between their rewrite counts of data is known. In the magnetic disk device, a rewrite count of data recorded on a recording medium is not limited, and the service life of the magnetic disk device is controlled under mechanical factors such as a damage caused by bringing a head into contact with the magnetic recording medium. On the other hand, in the EEPROM, a rewrite count of data is about 10.sup.4 to 10.sup.5 at most in the existing technique.
As described above, a "data" amount recorded in one sector of the magnetic disk device is 512 bytes, and this data amount is an amount of data recorded/reproduced by a user. Data required for recording/reproducing control are additionally written in the sector. As one type of such data, an error correction code (to be referred to as an ECC code hereinafter) is known. When user data is not correctly read due to a defective recording medium or influence of noise, the ECC code is used for detecting an error in the readout data and correcting the error. When data is to be written in a sector, the ECC code is calculated by an ECC generator on the basis of the data to be recorded so as to be written on a recording medium together with the data.
An access unit of the NAND-type EEPROM is one page, and one page corresponds to a sector of the magnetic disk device although a page is slightly different from a sector. In order to improve reliability, as in the magnetic disk device, a 1-page physical capacity is set to be larger than an amount of data recorded/reproduced by a user, and the redundancy is assigned to the ECC code. This is an effective scheme.
In a conventional magnetic disk device, initialization called "format" must be performed to use the magnetic disk device as a memory device. A track in which a series of sectors is arranged on the circumference of a magnetic recording medium is formed on the magnetic recording medium, and a plurality (normally, several hundreds or several thousands) of tracks are concentrically formed. At this time, a specific initialization pattern is written in a user data area of each sector, and data required for recording/reproducing control is written. An ECC calculated by the initialization pattern is written. On the other hand, as is apparent from the above description, an overwriting operation performed in the magnetic disk device cannot be performed to a page in which data is written in the NAND-type EEPROM. In order to rewrite data of even one page, an erasure operation must be performed using a block constituted by a plurality of pages. For this reason, the data of pages other than the page to be erased must be saved as needed, and the data must be written again after the erasure operation. Therefore, the pages whose data are erased are often preferably set in an erasure state until effective user data is written in the pages.
In the magnetic disk device, assuming that the guaranteed service life of the magnetic disk device is set to be 20,000 operating hours, and hours in a fraction of the service life are spent for rewriting data, it is estimated that rewrite operations can be performed in a file management area about 10.sup.9 times at least. In contrast to this, in the NAND-type EEPROM, the maximum rewrite count is about 10.sup.5, as described above. When the NAND-type EEPROM is used like a magnetic disk device in a worst case wherein writing operations are concentrated on one block, writing operations can be performed at most 1/10,000 times of that of the magnetic disk device. An apparent rewrite count is larger than the above rewrite count because positions at which actual data are written are distributed in the storage areas. However, if there is data which is not erased for a long time after the data is written, this phenomenon is equivalent to a decrease in writable area. For this reason, the rewrite count is decreased accordingly.
As in file management performed by an OS, a file may be generally recorded in any empty area of a data area, and the empty area is managed by a directory and a management table such as a FAT. This file management is applied to an EEPROM having a limited maximum rewrite count, and positions in which files are to be written can be easily distributed to prevent a rewriting operation from being concentrated on the same position. However, when a file is written or rewritten, the content of a file management table must be rewritten, and the frequency of rewriting of these table data is considerably higher than that of writing of data files. Furthermore, the content of the management table must always be recorded on a fixed position. Therefore, when an EEPROM is applied to a file memory device, a rewriting operation is concentrated on the area of the management table area, and the service life of the EEPROM may be shortened.
In the magnetic disk device, a check operation may be performed by an ECC in a sector in which effective user data is not written as in a sector in which the user data is written. In contrast to this, in the NAND-type EEPROM which is controlled such that an erased page is set in an erasure state until effective user data is written in the page, when a page in which the effective user data is not written is read out, the ECC examination circuit determines that an error has occurred because all data in the page including an ECC are set to be "1".
An operating system in a host computer does not normally read out only a page in which effective data is not written, but may load the page together with a page in which the effective data is written when a plurality of pages are used as a unit for file management. When a block is to be erased during an operation of rewriting a page, and a control unit in which means for controlling a saving operation of data cannot be known whether data is written in another page in the block to be erased is used, pages set in an erasure state must also be loaded in the buffer. In this case, when the ECC examination circuit is operated to the data in the pages set in an erasure state, although the pages are normal pages, the ECC examination circuit erroneously recognizes that an error has occurred, and error processing is started. As a result, the processing cannot be normally performed.
Prior art related to to present invention is disclosed in Published Unexamined Japanese Patent Application No. 2-292798 and Published Unexamined Japanese Patent Application No. 3-167644.